package com.controller;

import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;

import com.entities.Account;
import com.service.AccountService;

@SessionAttributes(types=Account.class)
@RequestMapping(value="/accountController")
@Controller
public class AccountController {

	@Autowired
	private AccountService accountService;
	
	@ResponseBody
	@RequestMapping(value = "/loginAccount")
	public boolean loginAccount(String accountName,String accountPassword,Map<String, Object> map) {
		Account account = this.accountService.loginAccount(accountName, accountPassword);
		if(account != null) {
			map.put("account", account);
			return true;
		}else {
			return false;
		}
	}
	
}
